package com.basic.library.bean

import android.text.TextUtils

/**
 * 基本数据结构
 */
class DataResult<T> {
    private var msg = ""
    var message: String? = null
        get() = if (field != null) field else msg
    var success: Boolean? = null
        get() = if (field != null) field else TextUtils.equals(rescode, RESULT_OK)
    var rescode: String? = null
    var total = 0
    var data // 数据返回
            : T? = null
        private set

    fun setData(data: T) {
        this.data = data
    }

    companion object {
        const val RESULT_OK = "00" // 发送成功
        const val RESULT_TokenWrong = "01" //
        const val RESULT_TokenError = "09" //
    }
}